package com.zq.designpaterns.create.absfactory;

import com.zq.designpaterns.create.bean.Blue;
import com.zq.designpaterns.create.bean.Green;
import com.zq.designpaterns.create.bean.Red;
import com.zq.designpaterns.create.enums.Colors;
import com.zq.designpaterns.create.enums.ShapeType;
import com.zq.designpaterns.create.interfaces.Color;
import com.zq.designpaterns.create.interfaces.Shape;

import java.util.Objects;

/**
 * ================================================
 * 作    者：程志强
 * 邮    箱：cheng.zhiqiang@cesgroup.com.cn
 * 版    本：1.0.0
 * 创建日期：2021/01/11  11:05
 * 修改日期：
 * 描    述：
 * 修订历史：
 * ================================================
 */
public class ColorFactory extends AbstractFactory {
    @Override
    public Shape getShape(ShapeType type) {
        return null;
    }

    @Override
    public Color getColor(Colors color) {
        if (Objects.isNull(color)) {
            return null;
        }
        switch (color) {
            case RED:
                return new Red();
            case GREEN:
                return new Green();
            case BLUE:
                return new Blue();
            default:
                return null;
        }

    }
}
